package com.sj.entity;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 *
 * </p>
 *
 * @author 小七
 * @since 2021-07-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Blog对象", description = "")
public class Blog implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "博客Id自动增长")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "博客标题")
    @NotBlank(message = "博客标题不能为空")
    private String title;

    @ApiModelProperty(value = "博客描述")
    private String description;

    @ApiModelProperty(value = "博客内容")
    @NotBlank(message = "博客内容不能为空")
    private String content;

    @ApiModelProperty(value = "转html后的博客内容")
    @TableField(exist = false)
    private String htmlContent;

    @ApiModelProperty(value = "博客展示图片")
    private String picture;

    @ApiModelProperty(value = "博客标签id")
    @TableField(exist = false)
    private Integer tagId;

    @ApiModelProperty(value = "添加和更新时传递的博客标签信息以逗号分割")
    @NotBlank(message = "博客标签不能为空")
    @TableField(exist = false)
    private String tagNames;

    @ApiModelProperty(value = "博客标签信息" , hidden = true)
    @TableField(exist = false)
    private List<Tag> tagList;

    @ApiModelProperty(value = "博客分类id")
    @NotNull(message = "博客分类不能为空")
    private Integer categoryId;

    @ApiModelProperty(value = "博客分类信息" , hidden = true)
    @TableField(exist = false)
    private Category category;

    @ApiModelProperty(value = "公开类型 0草稿 1公开 2仅自己可见")
    private Integer publicType;

    @ApiModelProperty(value = "博客状态 1 启用 0 禁用")
    @TableLogic(value = "1", delval = "0")
    private Integer status;

    @ApiModelProperty(value = "赞赏是否开启 1开启 0不开启")
    private Integer admire;

    @ApiModelProperty(value = "开启评论功能 1开启 0不开启")
    private Integer commentEnable;

    @ApiModelProperty(value = "访问次数")
    private Integer views;

    @ApiModelProperty(value = "置顶 0为不置顶 从大于零进行降序 大于0都是为置顶博客")
    private Integer top;

    @ApiModelProperty(value = "博客标志 原创 转载")
    private String flag;

    @ApiModelProperty(value = "转载声明是否开启 1开启 0不开启")
    private Integer shareStatement;

    @ApiModelProperty(value = "发布作者id")
    @NotNull(message = "发布作者不能为空")
    private Integer userId;

    @ApiModelProperty(value = "博客发布作者信息" , hidden = true)
    @TableField(exist = false)
    private User user;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


}
